package com.xdclass.priority;

/**
 * @Author: Timo
 * @Date: 2019/4/26 14:21
 * @Description: 设置线程优先级DEMO
 */
public class PriorityDemo1 {

    public static void main(String[] args) {
        Thread t1 = new Thread(() -> {
            while (true) {
                System.out.println(">>>>>>>>>>>>>>>>>>>>>>>线程1");
//                try {
//                    Thread.sleep(30L);
//                } catch (InterruptedException e) {
//                    e.printStackTrace();
//                }

            }


        }, "T_1");

        Thread t2 = new Thread(() -> {
            while (true) {
                System.out.println("<<<<<<<<<<<<<<<<<<<线程2");
//                try {
//                    Thread.sleep(30L);
//                } catch (InterruptedException e) {
//                    e.printStackTrace();
//                }
            }

        }, "T_2");
        t1.setPriority(Thread.MAX_PRIORITY);
        t2.setPriority(Thread.MIN_PRIORITY);
        t1.start();
        t2.start();
    }
}
